//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================

#ifndef __ELASTOS_ASSERT_H__
#define __ELASTOS_ASSERT_H__

#define EMPTY_EXPRESSION        ((void)0)

#ifndef _RELEASE

EXTERN_C void _assert(const char *, const char *, int);

#ifndef assert
#define assert(expr) \
        ((void)((expr) || (_assert(#expr, __FILE__, __LINE__), FALSE)))
#endif

#define assertmsg(expr, msg)    assert((expr) && (msg))
#define assert0()               assert(0)
#define assert0msg(msg)         assert(0 && (msg))

#define verify(expr)            assert(expr)
#define verifymsg(expr, msg)    assertmsg(expr, msg)

#define checkpoint() \
        kprintf("Checkpoint: file: %s, line: %d\n", __FILE__, __LINE__)

#else

#ifndef assert
#define assert(expr)            EMPTY_EXPRESSION
#endif

#define assertmsg(expr, msg)    EMPTY_EXPRESSION
#define assert0()               EMPTY_EXPRESSION
#define assert0msg(msg)         EMPTY_EXPRESSION

#define verify(expr)            ((void)(expr))
#define verifymsg(expr, msg)    ((void)(expr))

#define checkpoint()            EMPTY_EXPRESSION

#endif // ! _RELEASE

#endif //__ELASTOS_ASSERT_H__
